<include file="common/hearder"/>
<style>
    .md {
        border: 1px solid #f2f3f6;
        position: relative;
        margin-top: 10px;
    }

    .dq {
        display: block;
        margin-top: 20px;
    }

    .hr {
        width: 100%;
        height: 1px;
        border: 1px solid #cdcdcd;
    }
</style>
<h4><span class="dq  glyphicon glyphicon-user">员工调遣申请</span></h4>
<div class="hr"></div>
<form class="md" method="post">
    <div class="form-group col-xs-10 col-md-5">
        <label>被调员工</label>
        <input type="text" value="{$staff.stf_name}" class="form-control">
        <input type="hidden" value="{$staff.stf_id}" name="stf_id">
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>你的前公司</label>
        <input type="text" value="{$staff.cmpy_name}" class="form-control">
        <input type="hidden" value="{$staff.cmpy_id}" name="cmpy_fid">
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>现在的公司</label>
        <select name="cmpy_aid" class="form-control" id="gs_id">
            <?php foreach ($company as $cy){?>
            <option value="<?php echo $cy['cmpy_id'];?>"
            <?php echo $record['cmpy_aid']==$cy['cmpy_id'] ?'selected':''; ?> ><?php echo $cy['cmpy_name'];?></option>
            <?php }?>
        </select>
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>前部门</label>
        <input type="text" value="{$staff.dpt_name}" class="form-control">
        <input type="hidden" value="{$staff.dpt_id}" name="dpt_fid">
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>现在部门</label>
        <select name="dpt_aid" class="form-control" id="gw_id">

        </select>
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>前岗位</label>
        <input type="text" value="{$staff.pt_name}" class="form-control">
        <input type="hidden" value="{$staff.pt_id}" name="pt_fid">
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>现在岗位</label>
        <select name="pt_aid" class="form-control">

        </select>
    </div>
    <div class="form-group col-xs-10 col-md-5">
        <label>调离原因</label>
        <input type="text" name="rmd_becase" value="{$record.rmd_becase}" class="form-control" placeholder="调离原因">
    </div>

    <div class="form-group col-xs-10 col-md-5">
        <label class="am-radio-inline">
            <input type="hidden" name="state" value="0" checked>
        </label>
    </div>
    <div class="am-form-group col-xs-10 col-md-12">
        <input type="hidden" name="submit" value="1">
        <input type="hidden" name="stf_id" value="{$staff.stf_id}">
        <button type="submit" class="am-btn am-btn-primary">提交申请</button>
    </div>
</form>
<script>
    //部门
    $('#gs_id').change(function () {
        var gs_id=$(this).val();
        $.getJSON("{:U('Staffinfo/bm')}?gs_id="+gs_id,function (data) {
            var sel="";
            for(var i=0;i<data.length;i++){
                sel+='<option value="'+data[i].dpt_id+'">'+data[i].dpt_name+'</option>';
            }
            $('select[name="dpt_aid"]').html(sel);
        })
    });
    //岗位
    $('#gw_id').change(function () {
        var gw_id=$(this).val();
        $.getJSON("{:U('Staffinfo/gw')}?gw_id="+gw_id,function (data) {
            var sel="";
            for(var i=0;i<data.length;i++){
                sel+='<option value="'+data[i].pt_id+'">'+data[i].pt_name+'</option>';
            }
            $('select[name="pt_aid"]').html(sel);
        })
    });
</script>
<include file="common/footer"/>